#include<stdio.h>
#include<string.h>
//taking address of temporary array in expansion of macro "av_err2str"
int main()
{
    char a[100] = { 0 };
    gets(a);
    int sz = strlen(a);
    int right = sz - 1;
    int i;
    while (right != 0)
    {
        int count = 1;
        while (a[right] != ' '&&right!=0)
        {
            right--;
            count++;
        }
        if (right != 0)
        {
            for (i = 1; i < count; i++)
            {
                printf("%c", a[right + i]);
            }
            right--;
            printf(" ");
        }
    }
    i = 0;
    while (a[i] != ' ')
    {
        printf("%c", a[i]);
        i++;
    }
}